package edu.uclmgmu.bacteriosec.domain;

public class ProcessController implements Runnable {
	private Process process;
	private long timeout;
	private boolean destroyed;
	
	public ProcessController(Process p, long timeout) {
		this.process=p;
		this.timeout=timeout;
	}

	@Override
	public void run() {
		long timeIni=System.currentTimeMillis();
		long time=timeIni;
		do {
			time=System.currentTimeMillis();
		} while (time<timeIni+this.timeout);
		this.process.destroy();
		this.destroyed=true;
	}

	public boolean getDestroyed() {
		return this.destroyed;
	}
}
